#include<stdio.h>
int max(int a, int b)
{
	if (a > b)
		return a;
	else
		return b;
}

int max2(int arr2[],int n)
{
	int max3 = arr2[0];
	for (int b = 1; b <= n; b++)
	{
		
		if (arr2[b] > max3)
			max3 = arr2[b];

	}
	return max3;
}
int main()
{
	int n, i, a, j;
	int arr[100] = { 0 };
	int arr2[100] = { 0 };
	int dp[100] = { 0 };
	scanf_s("%d", &n);
	for (a = 1; a <= n; a++)
		scanf_s("%d", &arr[a]);

	for (i = 1; i <= n; i++)
	{
		dp[i] = 1;
		for (j = 1; j < i; j++)
		{
			if (arr[j] < arr[i])
				dp[i] = max(dp[i], dp[j] + 1);
		}
		arr2[i] = { dp[i] };
		/*printf("dp[%d]=%d\n", i, dp[i]);*/
	}
	int ret = max2(arr2, n);
	printf("%d\n", ret);
	return 0;
}